cmake_minimum_required(VERSION 3.5)

project(IMM-SYS LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 如果需要支持 Android，可以取消下面的注释并设置相应的变量
#if(ANDROID)
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
#    if (ANDROID_ABI STREQUAL "armeabi-v7a")
#        set(ANDROID_EXTRA_LIBS
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
#    endif()
#endif()

# 添加 Qt5 的模块，包括 Widgets、Concurrent、Network 和 Charts
find_package(Qt5 COMPONENTS Widgets Concurrent Network Charts REQUIRED)

if(ANDROID)
    add_library(IMM-SYS SHARED
        main.cpp
        mainwidget.cpp
        mainwidget.h
        mainwidget.ui
    )
else()
    add_executable(IMM-SYS
        main.cpp
        mainwidget.cpp
        mainwidget.h
        mainwidget.ui
        Function/register.cpp
        Function/register.h
        Function/register.ui
        Common/Logger.hpp
        Common/sqlmanagement.h
        Common/sqlmanagement.cpp
        Common/usermanagement.h
        Common/usermanagement.cpp
        Common/config.h
        Common/othertablemanagement.h
        Common/othertablemanagement.cpp
        ChildWidget/widget_doctor.h
        ChildWidget/widget_doctor.cpp
        ChildWidget/widget_doctor.ui
        ChildWidget/widget_patient.h
        ChildWidget/widget_patient.cpp
        ChildWidget/widget_patient.ui
        ChildWidget/chatwidget.h
        ChildWidget/chatwidget.cpp
        ChildWidget/healthassessmentclient.h
        ChildWidget/healthassessmentclient.cpp
        StyleSheet/MainWidget.qss
    )
endif()

# 合并链接库的指令，包括 Qt5Charts
target_link_libraries(IMM-SYS PRIVATE Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::Charts mysqlcppconn)
